//
//  JPushHttpService.m
//  XTCloud
//
//  Created by QA on 16/10/8.
//  Copyright © 2016年 ShangHai HaoLei Software Technology Co., Ltd. All rights reserved.
//

#import "JPushHttpService.h"
#import "ServiceConnect.h"
#import "NSKeyedArchiverUserLogin.h"

@implementation JPushHttpService

//注册设备RegistrationId
+ (void)deviceStateRegisterChange
{
//    NSString *registrationId = [JPUSHService registrationID];
    UserLoginNSCoding *userInfo = [NSKeyedArchiverUserLogin getUserLoginData];
    NSString *userId = userInfo ? userInfo.Id : @"";
    
    ServiceParametModel *model = [[ServiceParametModel alloc] init];
    [model setValue:@"IOS" forKey:@"deviceType"];
    [model setValue:@"1" forKey:@"registrationId"];
    [model setValue:userId forKey:@"userId"];
    
    ServiceConnect *content = [[ServiceConnect alloc] initWithMethodName:@"PushDeviceStateRegisterChange" dataArray:model];
    [content startConnectNetworkCompleted:^(ServiceResultModel *result, NSDictionary *userInfo) {
        NSLog(@"[JPushHttpService] %@",@"device State Register Change Success -Completed");
        
    } failed:^(NSError *error, NSDictionary *userInfo) {
        NSLog(@"[JPushHttpService] %@",@"device State Register Change Failure -Failed");
        
    } abnormal:^(NSError *error, NSDictionary *userInfo) {
        NSLog(@"[JPushHttpService] %@",@"device State Register Change Failure -Abnormal");
    }];
    
}

@end
